import { View, Text,FlatList,StyleSheet,TouchableOpacity } from 'react-native'
import React, { useEffect, useState } from 'react'
import { ThemedText } from '@/components/ThemedText'
import { ThemedView } from '@/components/ThemedView'
import AntDesign from '@expo/vector-icons/AntDesign';
import { useRouter } from 'expo-router'
import axios from 'axios';
export default function Setting() {
      const router = useRouter()
    const styles = StyleSheet.create({
        container: {
          flex: 1,
          backgroundColor: '#fff',
        },
        item: {
          flexDirection: 'row',
          justifyContent: 'space-between',
          alignItems: 'center',
          paddingVertical: 16,
          paddingHorizontal: 24,
          borderBottomWidth: 1,
          borderBottomColor: '#ddd',
        },
        title: {
          fontSize: 18,
          fontWeight: 'bold',
        },
        arrow: {
          fontSize: 35,
          color: '#999',
        },
        separator: {
          height: 1,
          backgroundColor: '#ddd',
        },
      });
       
      
      const [cid, setcid] = useState('677f8a026b8f7fa143a658de')
      const  getReal= async () => {
          let { data: { code, data } } = await axios.get(`http://192.168.1.18:3000/getreal?cid=${cid}`)
          if (code == 200) {
              console.log(data);
              
              if (data.length > 0) {
                   router.push('/setting/show')
              } else {
                  router.push('/setting/real')
              }
  
          }
      }
 
      
  return (
    <ThemedView>
       <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title} onPress={()=>{ router.push('/setting/updphone') }}> 修改资料 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
          <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title}  onPress={getReal}> 实名认证 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
          <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title} > 账号绑定 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
          <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title} > 个人信息收集清单 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
          
          <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title} > 个性化设置 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
          <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title} > 个人信息共享清单 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
          <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title} > 隐私政策简版 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
          <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title} > 清理缓存 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
          <TouchableOpacity style={styles.item}>
            <ThemedText style={styles.title} > 退出登录 </ThemedText>
            <AntDesign name="right" size={24} color="gray" />
          </TouchableOpacity>
    </ThemedView>
  )
}